<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <div v-text-color="color" style="width:200px;height:200px;">dddddddd</div>
    </div>
</body>

<script>
    new Vue({
        el: '#app',
        data: {
            color: 'red'
        },
        methods: {
            changeColor() {
                this.color = 'green';
            }
        },
        directives: {
            textColor: {
                inserted(el, binding) {
                    el.style.color = binding.value;
                },
                update(el, binding) {
                    el.style.color = binding.value;
                }
            }
        }
    });
</script>

</html>